import request from './request.js';

//登录
export const Login = (data) => {
	return request({
		url: '/login',
		method: 'post',
		data,
		needToken: false // 登录接口不需要token
	})
}

//获取用户列表
export const getUserList = () => {
	return request({
		url: '/test/user/list',
		method: 'get'
	})
}

//获取用户信息
export const getInfo = () => {
	return request({
		url: '/getInfo',
		method: 'get'
	})
}

//获取项目列表
export const getProjectList = (data) => {
	return request({
		url: '/system/project/list',
		method: 'get',
		data
	})
}

//获取合同列表
export const getContractList = (data) => {
	return request({
		url: '/system/contract/list',
		method: 'get',
		data
	})
}

//获取周期列表
export const getCyclemanagementList = (data) => {
	return request({
		url: '/system/cyclemanagement/mcList',
		method: 'get',
		data
	})
}

//获取计量树
export const getTreeselectList = (data) => {
	return request({
		url: '/system/manage/treeselect',
		method: 'get',
		data
	})
}

//获取计量表格
export const getMeteringpayList = (data) => {
	return request({
		url: '/system/meteringpay/list',
		method: 'get',
		data
	})
}

//添加合同计量
export const addMeteringpay = (data) => {
	return request({
		url: '/system/meteringpay',
		method: 'post',
		data: data
	})
}

//查询计量单号
export const getTotal = (data) => {
	return request({
		url: '/system/meteringpay/getTotal',
		method: 'get',
		data
	})
}

//查询材料入库列表
export const getmaterialSingle = (data) => {
	return request({
		url: '/system/materialSingle/list',
		method: 'get',
		data
	})
}

//获取供应商列表
export const getSupplierList = (data) => {
	return request({
		url: '/system/supplier/list',
		method: 'get',
		data
	})
}

//查询所有甲供供应商管理列表
export const getSupplierqueryAll = (data) => {
	return request({
		url: '/system/supplier/queryAll',
		method: 'get',
		data
	})
}

//获取状态列表
export const getStatusList = (data) => {
	return request({
		url: '/system/status/list',
		method: 'get',
		data
	})
}

//获取材料类型列表
export const getMaterialTypeList = (data) => {
	return request({
		url: '/system/materialType/list',
		method: 'get',
		data
	})
}

//获取供应商列表
export const getsupplier = (data) => {
	return request({
		url: '/system/supplier/list',
		method: 'get',
		data
	})
}

//查询材料供应商列表
export const getsupplierAll = (data) => {
	return request({
		url: '/system/supplier/queryAll',
		method: 'get',
		data
	})
}

//获取供应商列表
export const getNewCodeByProjectId = (data) => {
	return request({
		url: `/system/materialSingle/getNewCodeByProjectId/${data.projectId}`,
		method: 'get',
	})
}

//获取项目材料列表
export const getMaterialProject = (data) => {
	return request({
		url: '/system/materialProject/queryByParams',
		method: 'get',
		data
	})
}

//查询材料入库列表
export const getmaterialEntryApp = (data) => {
	return request({
		url: '/system/materialEntryApp/save',
		method: 'post',
		data
	})
}

//查询审批记录
export const getApprove = (data) => {
	return request({
		url: `/app/approve/list/${data.type}`,
		method: 'get',
	})
}

//查询审批记录
export const getApproveInfo = (data) => {
	return request({
		url: `/app/approve/info/${data.id}`,
		method: 'get',
	})
}

//查询撤回位置列表
export const getRevike = (data) => {
	return request({
		url: `/flow/afApprove/getTuiHuiList/${data.approveId}`,
		method: 'get',
	})
}

//审批提交
export const confirmExamine = (data) => {
	return request({
		url: '/flow/afApprove/examine',
		method: 'get',
		data
	})
}

//上传 
export const uploadCommon = (data) => {
	return request({
		url: '/common/upload',
		method: 'post',
		data
	})
}
//审批详情 
export const getExamine = (data) => {
	return request({
		url: `/app/approve/examine/${data.id}`,
		method: 'get',
	})
}

//入库详情
export const getMaterialSingleItem = (data) => {
	return request({
		url: `/system/materialSingleItem/list`,
		method: 'get',
		data
	})
}
// 设备管理列表
export const getSbmanageList = (data) => {
	return request({
		url: '/system/sbmanage/appList',
		method: 'get',
		data
	})
}
// /dev-api/system/sbmanage/countByGenreId/{projectId}
// 根据设备类别统计设备数
export const getCountByGenreIdList = (data) => {
	return request({
		url: '/system/sbmanage/countByGenreId/' + data,
		method: 'get',
		data
	})
}
// 项目列表
export const getSbmanageProjectList = (data) => {
	return request({
		url: '/system/sbmanage/import',
		method: 'post',
		data
	})
}
// 上传
export const upload = (data) => {
	return request({
		url: '/common/upload',
		method: 'post',
		data,
	})
}
// 加油统计信息
export const getStatistics = (data) => {
	return request({
		url: '/system/refuel/statistics',
		method: 'get',
		data,
	})
}

//提交 加油信息
export const postRefuel = (data) => {
	return request({
		url: '/system/refuel/save',
		method: 'post',
		data,
	})
}

//提交 加油信息
export const refuelLog = (data) => {
	return request({
		url: '/system/refuel/log',
		method: 'get',
		data,
	})
}
// 字典管理
export const datatype = (data) => {
	return request({
		url: '/system/dict/data/type/' + data,
		method: 'get',
		data,
	})
}

// 查询合同列表
export const queryByParam = (data) => {
	return request({
		url: '/system/contract/queryByParam',
		method: 'get',
		data,
	})
}

// 设备类型
export const getqueryByParam = (data) => {
	return request({
		url: '/system/mcMaterialGenre/queryByParam',
		method: 'get',
		data,
	})
}

// // 获取设备管理详细信息
// export const getsbmanage = (id) => {
// 	return request({
// 		url: `/system/sbmanage/${id}`,
// 		method: 'get',
// 		// data,
// 	})
// }

// /system/facilitydraw
// 出场
// export const facilitydraw = (data) => {
// 	return request({
// 		url: `/system/facilitydraw`,
// 		method: 'post',
// 		data,
// 	})
// }

// export const queryAllByRelatedIdIdAndType = (data) => {
// 	return request({
// 		url: `/system/file/queryAllByRelatedIdIdAndType`,
// 		method: 'get',
// 		data,
// 	})
// }

// // 设备进场
// export const postsbmanage = (data) => {
// 	return request({
// 		url: `system/sbmanage`,
// 		method: 'post',
// 		data,
// 	})
// }

// // 退还
// export const facilitydrawth = (data) => {
// 	return request({
// 		url: `/system/facilitydraw/th/${data}`,
// 		method: 'post',
// 		// data,
// 	})
// }
// // 计量
// export const othersb = (data) => {
// 	return request({
// 		url: `/system/other/sb`,
// 		method: 'post',
// 		data,
// 	})
// }

// 修改密码
export const updatePassword = (data) => {
	return request({
		url: `/system/user/profile/updatePwd?newPassword=${data.newPassword}&oldPassword=${data.oldPassword}`,
		method: 'put',
	})
}

//个人中心
export const getUserInfo = (data) => {
	return request({
		url: `/system/protocol/info?type=${data.type}`,
		method: 'get',
	})
}
export const getinfoForLogin = (data) => {
	return request({
		url: `/system/protocol/infoForLogin?type=${data.type}`,
		method: 'get',
	})
}

//退出登录
export const logout = () => {
	return request({
		url: '/mobile/login/logout',
		method: 'get',
	})
}

// // 设备类型
// export const getqueryByParam = (data) => {
// 	return request({
// 		url: '/system/mcMaterialGenre/queryByParam',
// 		method: 'get',
// 		data,
// 	})
// }

// 获取设备管理详细信息
export const getsbmanage = (id) => {
	return request({
		url: `/system/sbmanage/${id}`,
		method: 'get',
		// data,
	})
}

// /system/facilitydraw
// 出场
export const facilitydraw = (data) => {
	return request({
		url: `/system/facilitydraw`,
		method: 'post',
		data,
	})
}

export const queryAllByRelatedIdIdAndType = (data) => {
	return request({
		url: `/system/file/queryAllByRelatedIdIdAndType`,
		method: 'get',
		data,
	})
}

// 设备进场
export const postsbmanage = (data) => {
	return request({
		url: `/system/sbmanage`,
		method: 'post',
		data,
	})
}

// 退还
export const facilitydrawth = (data) => {
	return request({
		url: `/system/facilitydraw/th/${data}`,
		method: 'post',
		// data,
	})
}
// 计量
export const othersb = (data) => {
	return request({
		url: `/system/other/sb`,
		method: 'post',
		data,
	})
}
// 设备出场数
export const outCount = () => {
	return request({
		url: `/system/facilitydraw/outCount`,
		method: 'get',
	})
}

//项目材料列表
export const getProjectMaterial = (data) => {
	return request({
		url: `/system/materialProject/list?pageNum=${data.pageNum}&pageSize=${data.pageSize}&projectId=${data.projectId}&klyNum=1`,
		method: 'get',
		data
	})
}

// 油品类别
export const oilsInfo = (data) => {
	return request({
		url: `/system/refuel/oilsInfo`,
		method: 'get',
		data
	})
}
// 验证设备编码
export const checkCodeRepetition = (data) => {
	return request({
		url: `/system/sbmanage/checkCodeRepetition`,
		method: 'get',
		data
	})
}

//材料列表-项目
export const getProjectQueryByParam = (data) => {
	return request({
		url: `/system/project/queryByParam`,
		method: 'post',
		data
	})
}

//项目材料-领用列表
export const getMaterialDrawItem = (data) => {
	return request({
		url: `/system/materialDrawItem/list?${data}`,
		method: 'get',
		// data
	})
}

//项目材料-入库列表
export const getMaterialSingle = (data) => {
	return request({
		url: `/system/materialSingleItem/list?${data}`,
		method: 'get',
		// data
	})
}

//物料领用-施工合同列表
export const getContract = (data) => {
	return request({
        url: `/system/contract/queryByParam?projectId=${data.projectId}`,
        method: 'get',
        data
    })
}

// 验证设备编码
export const materialProjectSingle = (data) => {
	return request({
		url: `/system/materialProjectSingle/queryByParam`,
		method: 'get',
		data
	})
}

//物料领用-计量周期列表
export const getCyclemanagement = (data) => {
	return request({
        url: `/system/cyclemanagement/mcList?contractId=${data.contractId}`,
        method: 'get',
        data
    })
}

// 验证设备编码
export const facilitydrawList = (data) => {
	return request({
		url: `/system/facilitydraw/list`,
		method: 'get',
		data
	})
}

//物料领用-材料单价列表
export const getMaterialProjectSingle = (data) => {
	return request({
		url: `/system/materialProjectSingle/queryByParam?materialProjectId=${data.materialProjectId}`,
		method: 'get',
		data
	})
}

//物料领用-提交
export const getMaterialDraw = (data) => {
	return request({
		url: `/system/materialDraw`,
		method: 'post',
		data,
	})
}

//安全监控-列表
export const getMonitorList = (data) => {
	return request({
		url: `/system/monitor/list`,
		method: 'get',
		data,
	})
}

//安全监控-新增
export const addMonitor = (data) => {
	return request({
		url: `/system/monitor`,
		method: 'post',
		data,
	})
}

//安全监控-详情
export const detailMonitor = (data) => {
	return request({
		url: `/system/monitor/${data}`,
		method: 'get',
	})
}

//安全监控-修改
export const updateMonitor = (data) => {
	return request({
		url: `/system/monitor`,
		method: 'put',
		data,
	})
}

//安全监控-删除
export const deleteMonitor = (data) => {
	return request({
		url: `/system/monitor/${data}`,
		method: 'delete',
	})
}
// 
export const getTotalNumber = (data) => {
	return request({
		url: '/system/meteringpay/getTotalNumber',
		method: 'get',
		data
	})
}





